﻿// recharge.cpp: 实现文件
//

#include "pch.h"
#include "MFCdemo.h"
#include "recharge.h"
#include "afxdialogex.h"


// recharge 对话框

IMPLEMENT_DYNAMIC(recharge, CDialogEx)

recharge::recharge(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG4, pParent)
{

}

recharge::~recharge()
{
}

void recharge::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, user);
	DDX_Control(pDX, IDC_EDIT2, card);
}


BEGIN_MESSAGE_MAP(recharge, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &recharge::OnBnClickedButton1)
END_MESSAGE_MAP()


// recharge 消息处理程序


void recharge::OnBnClickedButton1()
{
	wchar_t User[100]{ 0 };
	user.GetWindowTextW(User, 100);

	wchar_t Card[100]{ 0 };
	card.GetWindowTextW(Card, 100);

	if (!sdk->UserRecharge(string_convert::UnicodeToANSI(User), string_convert::UnicodeToANSI(Card)))
	{
		SHOW_MSG(sdk->error_msg.c_str());
		return;
	}
	SHOW_MSG(("充值成功,到期时间 :" + sdk->Finaltime).c_str());
}
